package com.molichuxing.services.property;

/**
 * 
 * @author liyg 入库类型枚举类
 *
 */
public enum StockCarTypeEnum {

	/**
	 * 采购
	 */
	PURCHASE(1, "采购"),
	
	/**
	 * 调拨
	 */
	ALLOT(2, "调拨"),

	/**
	 * 拒收
	 */
	REJECTION(3, "拒收"),

	/**
	 * 收车
	 */
	COLLECT(4, "收车"),
	
	/**
	 * 退车
	 */
	CAR_BACK(5, "退车");

	
	int value;
	String name;

	StockCarTypeEnum(int value, String name) {
		this.value = value;
		this.name = name;
	}

	public int getValue() {
		return value;
	}

	public String getName() {
		return name;
	}


	/**
	 * 通过value获取枚举的name
	 * 
	 * @param value
	 * @return
	 */
	public static String getName(int value) {
		StockCarTypeEnum enumerate = getEnum(value);
		return enumerate == null ? null : enumerate.getName();
	}

	/**
	 * 通过value获取枚举
	 * 
	 * @param value
	 * @return
	 */
	public static StockCarTypeEnum getEnum(int value) {
		for (StockCarTypeEnum enumerate : StockCarTypeEnum.values()) {
			if (enumerate.getValue() == value) {
				return enumerate;
			}
		}
		return null;
	}
}
